package com.itheima.myanno3;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class AnnoDemo {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Class clazz = Class.forName("com.itheima.myanno3.UseTest");
        UseTest useTest = (UseTest) clazz.newInstance();

        Method[] Methods = clazz.getDeclaredMethods();
        for (Method Method : Methods) {
            //调用方法判断当前方法是否为注解方法
             if(Method.isAnnotationPresent(Test.class)){
                 //Method.invoke()   指的是运行方法
                 Method.invoke(useTest);
             }
        }
        
        
        
    }
}
